package org.agony2d.view 
{
	import flash.display.DisplayObject;
	import org.agony2d.view.supportClasses.AbstractMultiFusion;
	
	import org.agony2d.core.agony_internal;
	use namespace agony_internal;
	
final public class MultiFusion extends AbstractMultiFusion
{
	
	final public function setOrigin( ox:Number, oy:Number ) : void
	{
		m_shell.setOrigin(ox,oy)
	}
	
	final public function setState( stateType:Class, stateArgs:Array = null ) : void
	{
		if (m_state)
		{
			m_state.exit()
			m_shell.reset()
			m_view.m_notifier.removeAll()
			m_view.removeAllElement()
			m_state = null
		}
		if (stateType)
		{
			m_state = new stateType
			m_state.m_multiFusion = this
			m_state.m_stateArgs = stateArgs
			m_state.enter()
		}
	}
	
	final override public function get displayObject() : DisplayObject { return m_shell }
	
	override public function get x () : Number { return m_shell.x }
	override public function set x ( v:Number ) : void { m_shell.x = v }
	
	override public function get y () : Number{ return m_shell.y }
	override public function set y ( v:Number ) : void { m_shell.y = v }
	
	override public function get rotation () : Number { return m_shell.rotation }
	override public function set rotation ( v:Number ) : void { m_shell.rotation = v }
	
	override public function get scaleX () : Number { return m_shell.scaleX }
	override public function set scaleX ( v:Number ) : void { m_shell.scaleX = v }
	
	override public function get scaleY () : Number { return m_shell.scaleY }
	override public function set scaleY ( v:Number ) : void { m_shell.scaleY = v }
	
	override public function get alpha () : Number { return m_shell.alpha }
	override public function set alpha ( v:Number ) : void { m_shell.alpha = v }
	
	
	final override public function move( tx:Number, ty:Number ) : void
	{
		m_shell.move(tx, ty)
	}
	
	final override public function moveInStage( x:Number, y:Number ) : void
	{
		m_shell.moveInStage(x, y)
	}
	
	final override public function offset( tx:Number, ty:Number ) : void
	{
		m_shell.offset(tx, ty)
	}
	
	override agony_internal function dispose() : void
	{
		if (m_state)
		{
			m_state.exit()
			m_state = null
		}
		super.dispose()
	}
	
	agony_internal var m_state:UIState
}
}